<?php


namespace App\Http\Controllers\applets\api;


use App\Http\Controllers\applets\service\AppService;
use App\Http\Controllers\applets\validate\App;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;

class AppApi
{
    public function getSubject(Request $request){
        $param = $request->all();
        return AppService::getSubject($param);
    }

    public function getAdminAppDetails(Request $request){
        $param = $request->all();
        $data = App::getAdminAppDetails($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getAdminAppDetails($param);
    }
    
    public function getAdminApp(Request $request){
        $param = $request->all();
        $data = App::getAdminApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getAdminApp($param);
    }

    public function appInstall(Request $request){
        $param = $request->all();
        $data = App::adminApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }

        return AppService::appInstall($param);
    }

    public function appPush(Request $request){
        $param = $request->all();
        $data = App::adminApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        
        return AppService::appPush($param);
    }

    public function querySnLogInfo(Request $request){
        $param = $request->all();
        $data = App::querySnLogInfo($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::querySnLogInfo($param);
    }

    public function getInstallAppList(Request $request){
        $param = $request->all();
        $data = App::getInstallAppList($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getInstallAppList($param);
    }
    
    public function getAppUseTimeLog(Request $request){
        $param = $request->all();
        $data = App::getAppUseTimeLog($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getAppUseTimeLog($param);
    }

    public function checkRefresh(Request $request){
        $param = $request->all();
        $data = App::checkRefresh($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::checkRefresh($param);
    }

    public function queryAppLog(Request $request){
        $param = $request->all();
        $data = App::queryAppLog($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAppLog($param);
    }

    public function queryIdApp(Request $request){
        $param = $request->all();
        $data = App::queryIdApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryIdApp($param);
    }

    public function editAppAll(Request $request){
        $param = $request->all();
        $data = App::editAppAll($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::editAppAll($param);
    }

    public function queryParentApp(Request $request){
        $param = $request->all();
        $data = App::queryParentApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryParentApp($param);
    }

    public function deleteParent(Request $request){
        $param = $request->all();
        $data = App::deleteParent($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::deleteParent($param);
    }

    public function querySumAppLog(Request $request){
        $param = $request->all();
        $data = App::querySumAppLog($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::querySumAppLog($param);
    }

    public function cleanAppCache(Request $request){
        $param = $request->all();
        $data = App::cleanAppCache($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::cleanAppCache($param);
    }

    public function editAppSilent(Request $request){
        $param = $request->all();
        $data = App::editAppSilent($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::editAppSilent($param);
    }

    public function whiteAppUpdate(Request $request){
        $param = $request->all();
        $data = App::whiteAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::whiteAppUpdate($param);
    }

    public function whiteAppBySnId(Request $request){
        $param = $request->all();
        $data = App::whiteAppBySnId($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::whiteAppBySnId($param);
    }

    
}